/**
 ********************************************************************
 * @author roocket
 * @file    file_synchronize.h
 * @version V0.0.0
 * @date    2024/3/22
 * @brief   This file is to indicate file synchronize functions. 
 * @attention Code file rules:
 * rule: file encoding use UTF8;
 * rule: max line length 120 characters;
 * rule: line separator \r\n;
 * rule: use clion auto code format tool.
 */

#ifndef _FILE_SYNCHRONIZE_H_
#define _FILE_SYNCHRONIZE_H_

#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

/* file length */
#define FILE_SYNC_MAX_LENGTH (1024)
#define FILE_SYNC_BUFFER_LEN FILE_SYNC_MAX_LENGTH

/**
 * @brief Sync file by fread/fwrite file's content.
 * @note With two different file names in diretory,
 * the new file would be covered the old file.
 * @param old_file_name The old file.
 * @param new_file_name The new file.
 * @param t The sync-time.
 * @return Executed result.
 */
int file_sync_copy_content(const char *old_file_name, const char *new_file_name, double *t);

#endif /* _FILE_SYNCHRONIZE_H_ */

